///**
// * <p>Description: []</p>
// *
// * @ClassName ResourceServerConfig
// * Created on 2018/12/12.
// * @author <a href="mailto: sunxianwei@camelotchina.com">sunxiaozhe</a>
// * @version 1.0
// * 北京柯莱特科技有限公司 易用云
// */
//package com.camelot.zuul.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.http.SessionCreationPolicy;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
//import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
//import org.springframework.security.oauth2.provider.expression.OAuth2WebSecurityExpressionHandler;
//
///**
// * <p>Description: [资源服务配置]</p>
// * @ClassName ResourceServerConfig
// * Created on 2018/12/12.
// *
// * @author <a href="mailto: sunxianwei@camelotchina.com">sunxiaozhe</a>
// * @version 1.0
// *   北京柯莱特科技有限公司 易用云
// */
//@Configuration
//@EnableResourceServer // 开启资源服务器
//public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
//
//
//	@Autowired
//	private OAuth2WebSecurityExpressionHandler expressionHandler;
//
//	@Bean
//	public OAuth2WebSecurityExpressionHandler oAuth2WebSecurityExpressionHandler(ApplicationContext applicationContext) {
//		OAuth2WebSecurityExpressionHandler expressionHandler = new OAuth2WebSecurityExpressionHandler();
//		expressionHandler.setApplicationContext(applicationContext);
//		return expressionHandler;
//	}
//
//	@Override
//	public void configure(ResourceServerSecurityConfigurer resources) {
//		resources
//				.expressionHandler(expressionHandler)
//				.stateless(true);
//
//	}
//
//
//
//
//	@Override
//	public void configure(HttpSecurity http) throws Exception {
//		// 配置资源服务器的拦截规则
//		http.
//				sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
//				.and()
//				.requestMatchers().anyRequest()
//				.and()
//				.anonymous()
//				.and()
//				.authorizeRequests()
//				.antMatchers("/user/**").authenticated() // /user/** 端点的访问必须要验证后
//				.and()
//				.exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
//	}
//}
//
